home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / WINDOWS / CLIPSTAC.ARJ / WINDLG.CPP < prev    next >
C/C++ Source or Header  |  1992-03-27  |  1KB  |  51 lines

  1. // windlg.cpp RHS 1/15/91
  2.  
  3. #include"windlg.h"
  4.  
  5. inline void *GetWinDlgPtr(HWND hWnd)
  6.     {
  7. #if defined(__SMALL__) || defined(__MEDIUM__)
  8.     return (void *)GetWindowWord(hWnd,DLGWINDOWEXTRA);
  9. #elif defined(__LARGE__) || defined(__COMPACT__) || defined(__HUGE__)
  10.     return (void *)GetWindowLong(hWnd,DLGWINDOWEXTRA);
  11. #else
  12.     #error Must use Small, Medium, Large, Compact or Huge models!
  13. #endif
  14.     }
  15.  
  16. inline void SetWinDlgPtr(HWND hWnd, void *ptr)
  17.     {
  18. #if defined(__SMALL__) || defined(__MEDIUM__)
  19.     SetWindowWord(hWnd,DLGWINDOWEXTRA,(WORD)ptr);
  20. #elif defined(__LARGE__) || defined(__COMPACT__) || defined(__HUGE__)
  21.     SetWindowLong(hWnd,DLGWINDOWEXTRA,(LONG)ptr);
  22. #else
  23.     #error Must use Small, Medium, Large, Compact or Huge models!
  24. #endif
  25.     }
  26.   
  27.  
  28. Window *winDlg;
  29.  
  30. long far pascal WinDlgWndProc(HWND hWnd, WORD msg, WORD wParam, LONG lParam)
  31.     {
  32.     Window *w = (Window *)GetWinDlgPtr(hWnd);
  33.  
  34.     if(msg == WM_NCCREATE)
  35.         {
  36.         w = winDlg;
  37.         SetWinDlgPtr(hWnd, w);
  38.         w->SethWnd(hWnd);
  39.         }
  40.  
  41.     if(!w)
  42.         return DefWindowProc(hWnd, msg, wParam, lParam);
  43.     WinAppMsg m;
  44.     m.msg = msg;
  45.     m.wParam = wParam;
  46.     m.lParam = lParam;
  47.     m.msgRetVal = 0L;
  48.     StdWndProc(w,m);
  49.     return m.msgRetVal;
  50.     }
  51.